package com.tiancheng.trade.order.controller.app;

import com.tiancheng.trade.commom.core.data.PageInfo;
import com.tiancheng.trade.commom.core.data.Result;
import com.tiancheng.trade.order.service.RefundOrdersDetailService;
import com.tiancheng.trade.order.vo.app.RefundQueryVO;
import com.tiancheng.trade.order.vo.app.res.RefundQueryResVO;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 移动端退款接口
 *
 * @author kellen
 * @date 2024/6/2
 */
@Slf4j
@RestController
@RequestMapping("/app/refund")
@Validated
public class RefundAppController {

    @Resource
    private RefundOrdersDetailService refundOrdersDetailService;

    /**
     * 查询用户的退款列表
     * @param refundQueryVO
     * @return
     */
    @GetMapping("/query")
    public Result<PageInfo> query(RefundQueryVO refundQueryVO) {
        if(refundQueryVO.getSize() == 0) {
            refundQueryVO.setSize(10);
        }
        PageInfo<RefundQueryResVO> pageInfo = refundOrdersDetailService.findForApp(refundQueryVO);
        return Result.success(pageInfo);
    }
}
